﻿<!--#include file="conn.asp"-->
<%
abcd=request.QueryString("abcd")
currentPage=cint(request("page"))
MaxPerPage=140000
set rs=server.createobject("adodb.recordset")
set rs2=server.createobject("adodb.recordset")

htmlName=""&abcd&""
title="字母索引 "&abcd&""
zm=zm&"<img src=""../images/"&abcd&".gif"" alt="&abcd&"/>"
%>

<%


'################ 漫画列表开始 ################
sql= "select * from comics where zm like '%"& abcd &"%' order by id  desc"
rs.open sql,conn,1,1
if rs.eof then
mpage=1
allshu=0
else
h=0
rs.pagesize=MaxPerPage 
mpage=rs.pagecount     
rs.move  (currentPage-1)*MaxPerPage
allshu=rs.recordcount
do while not rs.eof
id=rs("id")
sql2="SELECT * FROM zj where cid="&rs("id")&" order by id desc"       
rs2.Open sql2,conn,1,1
if rs2.eof then
zj_name=""
zjid=""
add_date=""
else
zjid=rs2("id")
zj_name=left(rs2("zjmc"),8)
add_date=rs2("adddate")
end if
rs2.close
list=list&"<li><div class=""cover""><a href=""/comic/"&id&"/""><img src=""/cpic/"&rs("mhfm")&""" alt="&rs("mhmc")&" /></a>"
list=list&"</div><div class=""intro""><h2><a href=""/comic/"&id&"/"" title="&rs("mhmc")&">"&rs("mhmc")&"</a></h2><em>"
if rs("zt")=true then
list=list&"[ <a href=""/comic/"&rs("id")&"/"&zjid&""" target=""_blank"" class=""green"">已完结</a> ]</em>"
else
list=list&"[ 更新至：<a href=""/comic/"&rs("id")&"/"&zjid&""" target=""_blank"" class=""red"">"&zj_name&"</a> ]</em>"
end if
list=list&"<span>"&left(rs("mhjs"),70)&"...</span></div></li>"
rs.movenext
  h=h+1
if h>=MaxPerPage then exit do
loop

end if
rs.close
h=0
'################ 漫画列表结束 ################

'################ 访问前十漫画开始 ################
sql="select * from comics order by hits desc"
rs.open sql,conn,1,1
if rs.eof then
comic_hits="·还没有添加"
else
do while not rs.eof
titley=rs("mhmc")
hits=rs("hits")
h=h+1
comic_hits=comic_hits&"<li><a href=""/comic/"&rs("id")&"/"">"&rs("mhmc")&" </a></li>"
if h>=20 then exit do
rs.movenext
loop
end if
rs.close
 set rs = nothing 
 set conn = nothing
'################ 访问前十漫画结束 ################

'################ 分页开始 ################
pageno=currentPage
if cint(pageno)>1 then
pagefy=pagefy&"<a href="&htmlName&"_1.htm title=""首页"">首页</a>&nbsp;"
end if
if cint(pageno)>1 then
pagefy=pagefy&"<a href="&htmlName&"_"&pageno-1&".htm title=""上一页"">上一页</a>"
end if

pp=cint(pageno)-2            
  if pp<1 then            
  pp=1            
  end if            
p=0
for pno=pp to mpage
p=p+1
if pno*1=cint(pageno)*1 then
pagefy=pagefy&"<span>"&pno&"</span>"
else
pagefy=pagefy&"<a href="""&htmlName&"_"&pno&".htm"" title=""第"&pno&"页"">"&pno&"</a>"
end if                                                                        
if p>=5 then exit for            
next
pagefy=pagefy&"&nbsp;"
if cint(pageno)< mpage then
pagefy=pagefy&"<a href="&htmlName&"_"&pageno+1&".htm title=""下一页"">下一页</a>&nbsp;"
end if
if cint(pageno)< mpage then
pagefy=pagefy&"<a href="&htmlName&"_"&mpage&".htm title=""末页"">末页</a>"
end if

pagefy=pagefy&"<span class=""dot""><select name=""select"" onChange=""javascript:window.location.href=this.options[this.selectedIndex].value""><script> var total_page="&mpage&";var cur_page="&currentPage&";for (i=1;i<=total_page;i++){  if (i == cur_page) {    document.write(""<option selected value="&htmlName&"_""+i+"".htm>""+i+""</option>"");  } else{    document.write(""<option  value="&htmlName&"_""+i+"".htm>""+i+""</option>"");  }}</script></select></span>"

'################ 分页结束 ################


'################ 生成HTML结束 ################
Set fso = Server.CreateObject("Scripting.FileSystemObject")
'set fr=fso.opentextfile(server.mappath("TEMP/ABCD.htm"))
'pencat=fr.readall
'fr.close
pencat=ReadFromTextFile("TEMP/ABCD.htm","utf-8")
pencat=commonreplace(pencat)

pencat=replace(pencat,"[LIST]",list)
pencat=replace(pencat,"[PAGE]",pagefy)
pencat=replace(pencat,"[HITS]",comic_hits)
pencat=replace(pencat,"[TITLE]",title)
pencat=replace(pencat,"[ZM]",zm)
pencat=replace(pencat,"[FLDH]",fldh)
pencat=replace(pencat,"[WEB_NAME]",web_name)
pencat=replace(pencat,"[WEB_URL]",web_url)
pencat=replace(pencat,"[WEB_BA]",miibeian)
pencat=adreplace(pencat)
filename="../list/"&htmlName&".htm"
'Set fout = fso.CreateTextFile(server.mappath(filename))
'fout.Write pencat
'fout.close
WriteToTextFile "../list/"&htmlName&".htm",pencat,"utf-8"
'************** 生成HTML页 结束 ***************
%>
